package com.zpark.service.impl;

import com.zpark.mapper.IBooksMapper;
import com.zpark.pojo.Books;
import com.zpark.service.IBooksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务层接口实现类
 */
@Service
public class BooksServiceImpl implements IBooksService {

    @Autowired
    private IBooksMapper booksMapper;

    @Override
    public Integer addBook(Books books) {
        return booksMapper.insertBook(books);
    }

    @Override
    public Integer removeBooksById(Integer id) {
        return booksMapper.deleteBooksById(id);
    }

    @Override
    public Integer changeBooks(Books books) {
        return booksMapper.updateBooks(books);
    }

    @Override
    public Books findBooksById(Integer id) {
        return booksMapper.selectBooksById(id);
    }

    @Override
    public List<Books> findAll() {
        return booksMapper.selectAll();
    }

    @Override
    public Books findBookByName(String name) {
        return booksMapper.selectBookByName(name);
    }
}
